<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<link rel="stylesheet" type="text/css" href="/public/hui/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/public/hui/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/public/hui/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/public/hui/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/public/hui/static/h-ui.admin/css/style.css" />
<title>CI 后台系统 管理员添加</title>
</head>
<body>
<article class="cl pd-20  col-xs-10 col-xs-offset-1">
	<form action="" method="post" class="form form-horizontal" id="form">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">* </span>账号：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="4到12个字符" id="account" name="account">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">* </span>昵称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text"  value="" placeholder="" id="nickname" name="nickname">
			</div>
		</div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">分配角色：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span class="select-box">
                <select class="select" size="1" name="role_id">
                    <option value="">暂不分配</option>
                    <? foreach ($list as $k=>$v):?>
                    <option value="<?=$v['id']?>"><?=$v['NAME']?></option>
                    <? endforeach;?>
                </select>
                </span>
            </div>
        </div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">* </span>密码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="password" class="input-text" autocomplete="off"  placeholder="6到16个字符" id="password" name="password">
			</div>
		</div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">* </span>确认密码：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="password" class="input-text" autocomplete="off"  placeholder="确认密码" id="password2" name="password2">
            </div>
        </div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</article>


<script type="text/javascript" src="/public/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="/public/lib/layer/layer.js"></script>
<script type="text/javascript" src="/public/hui/static/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="/public/hui/static/h-ui.admin/js/H-ui.admin.page.js"></script>
<script type="text/javascript" src="/public/lib/validate/jquery.validate.min.js"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#form").validate({
		rules:{
            account:{
				required:true,
				minlength:4,
				maxlength:12
			},
            nickname:{
                required:true
            },
			password:{
				required:true,
                minlength:4,
                maxlength:16
			},
			password2:{
				required:true,
				equalTo: "#password"
			}
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
            $.ajax({
                dataType:'json',
                type: 'post',
                url: '/Systems/administrator_do',
                data: $('#form').serialize(),
                success: function(data){
                    if(1 == data){
                        layer.msg('增加成功!', {
                            icon: 1,
                            time: 2000 //2秒关闭（如果不配置，默认是3秒）
                        }, function(){
                            parent.layer.closeAll();
                        });
                    }else if(2 == data){
                        layer.msg('账号已存在!');
                    }else{
                        layer.msg('增加失败!');
                    }
                }
            });
		}
	});
});
</script>
</body>
</html>